import backManagerRouter from '../../router/router'
import specialRouter from '../../router/specialRouter';

const state = {
	addRoutes: [],
	routes: []
}

const mutations = {
	SET_ROUTES: (state, routes) => {
		state.routes = routes;
		state.addRoutes = routes;
	}
}

const actions = {
	generateRoutes({commit}, roles) {
		return new Promise(resolve => {
			let routes = [];
			routes.push(...backManagerRouter);
			commit('SET_ROUTES', routes);
			resolve()
		})
	},
	getSpecialRouter({commit}, roles){
		return new Promise(resolve => {
			let routes = [];
			routes.push(...specialRouter);
			commit('SET_ROUTES', routes);
			resolve()
		})
	}
}

export default {
	namespaced: true,
	state,
	mutations,
	actions
}
